home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / modula-3 / src-m3-3.000 / src-m3-3 / usr / local / soft / modula3-3.4 / bin / vostart < prev   
Encoding:
Text File  |  1995-01-30  |  5.1 KB  |  204 lines

  1. #! /usr/local/soft/modula3-3.4/bin/vorun -r
  2. sys_printText("Started SAFE VISUAL OBLIQ Interpreter...\n");
  3. sys_printText("Installing Visual Obliq support.\n\n");
  4. sys_printFlush();
  5.  
  6. (* check if a network object daemon is running 
  7.     start one if necessary
  8. *)
  9.  
  10. var NetObjPing =
  11. {
  12.   ping => meth(s) 
  13.     true
  14.  end
  15. };
  16.  
  17.  
  18. var NODexists = false;
  19. try
  20.     net_export("VONetObjPing", "", NetObjPing);
  21.  
  22.     if net_import("VONetObjPing", "").ping() then
  23.             NODexists:=true;
  24.     end
  25. except else
  26. end;
  27.  
  28. if not(NODexists) then
  29.     processNew(["netobjd","&"], false);
  30.     sys_printText("Starting Network object daemon...\n");
  31.     pause(1.0);
  32. else
  33.     sys_printText("Network object daemon already present.\n");
  34. end;
  35.  
  36. sys_printFlush();
  37.  
  38.  
  39. var installVOA = true;
  40.  
  41. try 
  42.   net_import("vos", "").ping();
  43.   installVOA := false;
  44.   sys_printText("Visual Obliq Agent already present!\n");
  45. except else
  46. end;
  47.  
  48. if installVOA then
  49.   let fv = 
  50.     "(Shape (Width 600) (Height 300) (Font" &
  51.     "\"-\*-helvetica-bold-\*R-\*240-\*\") (LabelFont" &
  52.     "\"-\*-helvetica-bold-\*R-\*240-\*\") (VBox (Text (BgColor" &
  53.     "\"DarkBrown\") (Color \"White\") \"Session Request\") (Text (Color" &
  54.     "\"DarkBrown\") \"You are invited to join a session of\") (Text (Color" &
  55.     "\"Red\") (Name name) \"foo\") Fill (HBox Fill (Button (Name accept)" &
  56.     "(BgColor \"PaleGreen\") (Rim (Pen 5) \"Accept\")) Fill (Button (Name " &
  57.     "reject) (BgColor \"LightRed\") (Rim (Pen 5) \"Reject\")) Fill) Fill))";
  58.  
  59.   let vos = {
  60.     Install => meth(s, constructor, name)
  61.       let noticeform = form_new(fv);
  62.       form_putText(noticeform, "name", "", name, false);
  63.       form_attach(noticeform, "accept", 
  64.         proc(fv) 
  65.           form_hide(fv);
  66.           (constructor)(volibLocal);
  67.           end);
  68.       form_attach(noticeform, "reject", 
  69.         proc(fv) 
  70.           form_hide(fv); 
  71.           ok 
  72.           end);
  73.       form_show(noticeform);
  74.       ok
  75.       end,
  76.      ping => meth(s)
  77.         true
  78.      end
  79.     };
  80.   net_export("vos", "", vos);
  81. sys_printText("Started Visual Obliq Agent on " & sys_address & " ...\n");
  82. end;
  83. sys_printFlush();
  84.  
  85. (*************** derived from cgiserver.obl **********************************************)
  86. var installSSN = true;
  87.  
  88. try 
  89.   net_import("vossns", "").ping();
  90.   installSSN := false;
  91.   sys_printText("Visual Obliq Session Agent  already present!\n");
  92. except else
  93. end;
  94.  
  95. if installSSN then
  96.  
  97.     let MakeHtmlLink = proc(message, linkto)
  98.         "<A HREF=\"" & linkto & "\">" & message &   "</A>";
  99.     end;
  100.  
  101.  
  102.     let sessnob =
  103.     {
  104.         sessions => [],
  105.  
  106.          ping => meth(s)
  107.                  true
  108.               end,
  109.  
  110.         addNew => meth(s, name, site)
  111.  
  112.             (* check if it is already registered, if so return         *)
  113.             (* this is ok because this would mean the new         *)
  114.             (* session object will supersede the earlier object *)
  115.             (* by the same name.                                                  *)
  116.  
  117.             var exists = false;
  118.                  foreach i in s.sessions do
  119.                 if (i.n is name) and (i.s is site) then 
  120.                     exists := true;
  121.                 end;
  122.             end;
  123.  
  124.             if not (exists) then
  125.                 s.sessions := s.sessions @
  126.                         [{ n => name,
  127.                               s =>  site }];
  128.             end;
  129.         end,
  130.  
  131.         genListing => meth(s, partialcmd)
  132.             var l = "Content-type: text/html\n\n\n" &
  133.                 "<TITLE>List of Sessions</TITLE>\n<UL>\n" &
  134.                 "<H2>Sessions Registered with this Server</H2>\n" &
  135.                 "(Generated automatically by vossns@" & sys_address & ")<P><P>\n" &
  136.                 "<i>This page lists a set of Visual Obliq Sessions that are currently in progress. " &
  137.                 "You may join a session by clicking on a corresponding link. This will cause the " &
  138.                 "session-constructor to be imported within a 'safe' Visual Obliq interpreter on " &
  139.                 " your site. Whenever the imported program tries to access " &
  140.                        "a file or spawn a process you will be notified and allowed to abort it, unless the action" &
  141.                     " is allowed in your </i>.vo.exempt<i> file.</i><P><P>\n";
  142.             foreach i in s.sessions do
  143.                 try 
  144.                     let sessnob = net_import(i.n, i.s);
  145.                     sessnob.New; (* just to see if the constructor proc is available *)
  146.                      (* If the session was dead there would be an exception by this time
  147.                         this helps us make sure the session really exists *)
  148.                     l := l & "<LI> " & MakeHtmlLink( i.n & " at " & i.s, partialcmd & "+" &  i.n & "+" & i.s);
  149.                 except
  150.                 else
  151.                 end;
  152.             end;
  153.             l := l & "\n";
  154.  
  155.         (* Uncomment these lines to debug output html
  156.             sys_printText(l);
  157.             sys_printFlush();        
  158.         *)
  159.             l
  160.         end
  161.     
  162.     };
  163.  
  164.     net_export("vossns", "", sessnob);
  165.     sys_printText("Registered  Visual Obliq Name-Server vossns@" & sys_address & "\n");
  166. end;
  167.  
  168. (* Create a compute engine called VOReceiver *)
  169. var installVOR = true;
  170.  
  171. try 
  172.     let n = net_importEngine("VOReceiver", "");
  173.     installVOR := false;
  174. except
  175. else
  176.     net_exportEngine("VOReceiver", "", 0);
  177.     sys_printText("Created a Visual Obliq Receiver -  VOReceiver@" & sys_address & "\n");
  178. end;
  179.  
  180.  
  181. sys_printFlush();
  182. (********************************************************************************************)
  183.  
  184. if (installVOA or installSSN or installVOR) then
  185.     sys_printText("\nVisual Obliq support is now in operation.\nYou may proceed.\n\n");
  186.     sys_printFlush();
  187.     loop
  188.         pause(2000.0);
  189.     end;
  190. else
  191. sys_printText("\nVisual Obliq support in operation.\n Please delete the window that pops up now.\n\n");
  192. sys_printFlush();
  193. end;
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.